1. Field of the Invention
The present invention relates to a semiconductor device and a method for controlling the same, and more particularly, to a semiconductor device capable of being selectively switched between an oscillation circuit and a signal input-output circuit, and a method for controlling the same.
2. Description of Related Art
Oscillation circuits that generate a clock for a CPU or a timer are roughly classified into a built-in oscillation circuit and a crystal oscillation circuit that requires an external component. The built-in oscillation circuit requires no external component, which read to a reduction in cost. However, in general, the frequency accuracy of the built-in oscillation circuit is low. On the other hand, the crystal oscillation circuit has a high frequency accuracy, though it requires the external component (a crystal oscillation device). For this reason, the crystal oscillation circuit is usually used for a clock generation circuit for a timer. Recently, many of general-purpose ICs such as a microcomputer implement both the built-in oscillation circuit and the crystal oscillation circuit. Thus, those circuits can be selectively used by using software.
A circuit that implements both the built-in oscillation circuit and the crystal oscillation circuit is capable of selectively using those circuits in such a way that a CPU is operated by the high speed built-in oscillation circuit when high performance is needed, and the crystal oscillation circuit is used for an operation (a timer operation) in a standby state, for example. Some microcomputers are used for the timer operation in most of the lifecycle, depending on the environment in which the microcomputers are used. Therefore, a reduction in power consumption of the crystal oscillation circuit is very beneficial for the microcomputers.
Meanwhile, common components have been widely used for the microcomputers to achieve the low cost. In particular, pads for an I/O buffer of the microcomputer need to be shared due to their many functions, because the number of pins and areas are restricted. The crystal oscillation circuit that requires the external crystal oscillation device uses at least two pads. Therefore, it is important to share the pads.
Since the crystal oscillation circuit requires the external component, a leakage current and a parasitic capacitance are generated and cause bias fluctuation, which leads to decreased oscillation stability. To solve these problems, an oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711 implements a DC-cutting capacitor for cutting a DC bias at an input terminal of the oscillation circuit.
FIG. 6 is a diagram illustrating the oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711. As shown in FIG. 6, the oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711 includes a crystal oscillator 110 serving as an oscillating source, and a main circuit portion 120 which is connected to the crystal oscillator 110 through a signal path and which is oscillated and driven. The main circuit portion 120 is formed as a semiconductor device, and both ends of the crystal oscillator 110 are connected to input-output terminals Xin and Xout of the signal path.
The main circuit portion 120 includes an inverter 122 that is connected to the crystal oscillator 110 through the input-output terminals Xin and Xout; a feedback resistor 124; and a DC-cutting capacitor 126 that is an element galvanically, or in a DC manner, isolating the signal path provided between an input side of the inverter 122 and the input terminal Xin of the signal path. Electrostatic protection circuits 140-1 and 140-2 are provided to signal lines on the input-output terminals Xin and Xout sides of the main circuit portion 120, thereby preventing any surge voltage that intrudes from the exterior from intruding into the main circuit portion 120. In this case, Cy1 and Cy2 denote parasitic capacitances of diodes. Cg and Cd denote capacitances on the input terminal side and the output terminal side of the crystal oscillator 110, respectively. In addition, Cx denotes a parasitic capacitance of the DC-cutting capacitor 126.
If the DC-cutting capacitor 126 is provided within the circuit, as in the case of the oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711, the potential of the input terminal Xin of the crystal oscillator 110 is close to an open state and the input terminal potential is unstable. Any change in the potential of the input terminal Xin of the crystal oscillator 110 changes each depletion layer of the parasitic capacitances Cy1, Cy2, and Cx connected to the input terminal Xin, so that the capacitance also changes. Therefore, if a slight leakage occurs at the input terminal Xin of the crystal oscillator 110 due to an external disturbance such as an increase of humidity or light, and the potential of the input terminal Xin changes, the parasitic capacitances also change accordingly. Since the oscillation frequency of the oscillation circuit also changes as a result of such a change in the parasitic capacitances, a problem occurs in that it becomes difficult to obtain stable oscillation.
To solve the above-mentioned problems, a potential stabilization circuit 150 is provided at the input terminal Xin side of the crystal oscillator 110 in the oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711. In this case, bias resistors 160 and 162 are used for the potential stabilization circuit 150. The bias resistor 160 is connected between the input terminal Xin side and a constant voltage Vreg side, and the bias resistor 162 is connected between the input terminal Xin side and a reference potential Vss side. This configuration makes it possible to suppress an unstable oscillation even if the leakage occurs at the pad for connecting to the external in the oscillation circuit disclosed in Japanese Unexamined Patent Application Publication No. 2004-96711.